import static org.junit.Assert.assertEquals;

import org.junit.Test;

/**
 * JUnit test class for parsing users.
 * 
 * @author Jay Fernandez
 * @version June 1, 2011
 *
 */
public class UsersTest {

	/**
	 * Tests the constructor of Users to test if
	 * parsing is done correctly.
	 */
	@Test
	public void testUsers() {
		Users users = new Users("testusers.csv");
		
		User student = users.getStudents().get(0);
		User teacher = users.getInstructors().get(0);
		User advisor = users.getAdvisors().get(0);
		
		assertEquals(student.getUsername(), "john_white");
		assertEquals(teacher.getUsername(), "jack_wilson");
		assertEquals(advisor.getUsername(), "mike_thomas");
		
		
		assertEquals(student.getPreferences().get(0).getCourseId(), "TBUS320");
		assertEquals(teacher.getPreferences().get(0).getCourseId(), "TBUS350");
		assertEquals(advisor.getPreferences().get(0).getCourseId(), "TBUS569");

		assertEquals(student.getPreferences().get(0).getDay(), "TR");
		assertEquals(teacher.getPreferences().get(0).getDay(), "TR");
		assertEquals(advisor.getPreferences().get(0).getDay(), "MW");

		assertEquals(student.getPreferences().get(0).getStartTime(), 800);
		assertEquals(teacher.getPreferences().get(0).getStartTime(), 1615);
		assertEquals(advisor.getPreferences().get(0).getStartTime(), 1330);
		
		assertEquals(student.getPreferences().get(0).getEndTime(), 1005);
		assertEquals(teacher.getPreferences().get(0).getEndTime(), 1820);
		assertEquals(advisor.getPreferences().get(0).getEndTime(), 1535);

	}

}
